package com.douxg.learning.springboot.base.youxi.shuipaixu;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @Description
 * @Auther douxg
 * @Date 2022/9/17 21:20
 */
@Data
@Accessors(chain = true)
public class Step {
    /**
     * 来源
     */
    private String source;
    /**
     * 目标
     */
    private String target;

    public String print() {
        return source + ">" + target;
    }

    public static Step parse(String print) {
        if (!StrUtil.isBlank(print)) {
            String[] split = print.split(">",2);
            if (split.length == 2) {
                return new Step().setSource(split[0]).setTarget(split[1]);
            }
        }
        return null;
    }
}
